<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">

    <Style x:Key="ScrollBar.Button.Line" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="True"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="FocusVisualStyle" Value="{x:Null}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Path
						 x:Name="Arrow"
						 HorizontalAlignment="Center"
						 VerticalAlignment="Center"
						 Fill="{DynamicResource FlatHeaderBorderBrush}"
						 Data="{Binding Path=Content,RelativeSource={RelativeSource TemplatedParent}}" />
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsPressed" Value="true">
                            <Setter TargetName="Arrow" Property="Fill" Value="{DynamicResource FlatHeaderPressedBackgroundBrush}" />
                        </Trigger>
                        <Trigger Property="UIElement.IsMouseOver" Value="True">
                            <Trigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <Storyboard.Children>
                                            <ColorAnimation To="#FF3A3A3A" FillBehavior="HoldEnd" Duration="00:00:00.2000000" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" />
                                        </Storyboard.Children>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.ExitActions>
                            <Trigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <Storyboard.Children>
                                            <ColorAnimation To="#FF6D6D6D" FillBehavior="HoldEnd" Duration="00:00:00.1000000" Storyboard.TargetName="Arrow" Storyboard.TargetProperty="(Path.Fill).(SolidColorBrush.Color)" />
                                        </Storyboard.Children>
                                    </Storyboard>
                                </BeginStoryboard>
                            </Trigger.EnterActions>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="false">
                            <Setter Property="Opacity" Value="0.5" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBar.Button.Page" TargetType="{x:Type RepeatButton}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBar.Thumb.Horizontal" TargetType="{x:Type Thumb}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="MinWidth" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Name="borThumb" Margin="3" MinWidth="24" Background="{DynamicResource VOColor15}" Opacity="0.5"/>
                    <ControlTemplate.Triggers>
                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
                            <EventTrigger.Actions>
                                <BeginStoryboard Name="beginMouseEnter">
                                    <Storyboard>
                                        <DoubleAnimation To="1" Duration="0:0:0.4" Storyboard.TargetName="borThumb" Storyboard.TargetProperty="(Grid.Opacity)" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
                            <EventTrigger.Actions>
                                <StopStoryboard BeginStoryboardName="beginMouseEnter" />
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation To=".5" Duration="0:0:0.4" Storyboard.TargetName="borThumb" Storyboard.TargetProperty="(Grid.Opacity)" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ScrollBar.Thumb.Vertical" TargetType="{x:Type Thumb}">
        <Setter Property="BorderThickness" Value="0" />
        <Setter Property="HorizontalContentAlignment" Value="Center" />
        <Setter Property="VerticalContentAlignment" Value="Center" />
        <Setter Property="Padding" Value="0" />
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="MinHeight" Value="24" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border Name="borThumb" Margin="3" MinHeight="24" Background="{DynamicResource VOColor15}" Opacity="0.5"/>
                    <ControlTemplate.Triggers>
                        <EventTrigger RoutedEvent="Mouse.MouseEnter">
                            <EventTrigger.Actions>
                                <BeginStoryboard Name="beginMouseEnter">
                                    <Storyboard>
                                        <DoubleAnimation To="1" Duration="0:0:0.4" Storyboard.TargetName="borThumb" Storyboard.TargetProperty="(Grid.Opacity)" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                        <EventTrigger RoutedEvent="Mouse.MouseLeave">
                            <EventTrigger.Actions>
                                <StopStoryboard BeginStoryboardName="beginMouseEnter" />
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation To=".5" Duration="0:0:0.4" Storyboard.TargetName="borThumb" Storyboard.TargetProperty="(Grid.Opacity)" />
                                    </Storyboard>
                                </BeginStoryboard>
                            </EventTrigger.Actions>
                        </EventTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="ScrollBar.Vertical" TargetType="{x:Type ScrollBar}">
        <Grid >
            <Grid.RowDefinitions>
                <RowDefinition MaxHeight="14"/>
                <RowDefinition Height="*"/>
                <RowDefinition MaxHeight="14"/>
            </Grid.RowDefinitions>
            <RepeatButton
			  Grid.Row="0"
			  Style="{DynamicResource ScrollBar.Button.Line}"
			  Height="18"
			  Width="16"
			  Command="ScrollBar.LineUpCommand"
			  Content="M 0 4 L 8 4 L 4 0 Z" />
            <Track
			  Name="PART_Track"
			  Grid.Row="1"
			  Width="16"
			  HorizontalAlignment="Center"
			  IsDirectionReversed="True">
                <Track.DecreaseRepeatButton>
                    <RepeatButton
					  Style="{DynamicResource ScrollBar.Button.Page}"
					  Command="ScrollBar.PageUpCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{DynamicResource ScrollBar.Thumb.Vertical}"/>
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton
					  Style="{DynamicResource ScrollBar.Button.Page}"
					  Command="ScrollBar.PageDownCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
			  Grid.Row="3"
			  Style="{DynamicResource ScrollBar.Button.Line}"
			  Height="18"
			  Width="16"
			  Command="ScrollBar.LineDownCommand"
			  Content="M 0 0 L 4 4 L 8 0 Z"/>
        </Grid>
    </ControlTemplate>

    <ControlTemplate x:Key="ScrollBar.Horizontal" TargetType="{x:Type ScrollBar}">
        <Grid >
            <Grid.ColumnDefinitions>
                <ColumnDefinition MaxWidth="18"/>
                <ColumnDefinition Width="*"/>
                <ColumnDefinition MaxWidth="18"/>
            </Grid.ColumnDefinitions>
            <RepeatButton
			  Grid.Column="0"
			  Style="{DynamicResource ScrollBar.Button.Line}"
			  Width="18"
			  Command="ScrollBar.LineLeftCommand"
			  Content="M 4 0 L 4 8 L 0 4 Z" />
            <Track
			  Name="PART_Track"
			  Grid.Column="1"
			  VerticalAlignment="Center"
			  IsDirectionReversed="False">
                <Track.DecreaseRepeatButton>
                    <RepeatButton
					  Style="{DynamicResource ScrollBar.Button.Page}"
					  Command="ScrollBar.PageLeftCommand" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Style="{DynamicResource ScrollBar.Thumb.Horizontal}" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton
					  Style="{DynamicResource ScrollBar.Button.Page}"
					  Command="ScrollBar.PageRightCommand" />
                </Track.IncreaseRepeatButton>
            </Track>
            <RepeatButton
			  Grid.Column="3"
			  Style="{DynamicResource ScrollBar.Button.Line}"
			  Width="18"
			  Command="ScrollBar.LineRightCommand"
			  Content="M 0 0 L 4 4 L 0 8 Z"/>
        </Grid>
    </ControlTemplate>

    <Style x:Key="{x:Type ScrollBar}" TargetType="{x:Type ScrollBar}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Width" Value="Auto"/>
                <Setter Property="Height" Value="18" />
                <Setter Property="Template" Value="{DynamicResource ScrollBar.Horizontal}" />
            </Trigger>
            <Trigger Property="Orientation" Value="Vertical">
                <Setter Property="Width" Value="18"/>
                <Setter Property="Height" Value="Auto" />
                <Setter Property="Template" Value="{DynamicResource ScrollBar.Vertical}" />
            </Trigger>
        </Style.Triggers>
    </Style>

</ResourceDictionary>